﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using University.Workshop.Model;
using University.Workshop.Business;

namespace University.Workshop.Presenters
{
    public class PrescriptionPresenter
    {
        IPrescription view;
        List<Prescription> prescriptionList = new List<Prescription>();

        public PrescriptionPresenter(IPrescription view)
        {
            this.view = view;
        }

        public void AddMedicineToPrescription()
        {
            Prescription newPrescription = new Prescription(view.PrescriptionId,view.Medicine,view.Quantity);
            prescriptionList.Add(newPrescription);
            view.SetPrescriptions(prescriptionList);
        }

        public string GeneratePrescription()
        {
            if (PrescriptionManager.AddPrescriptions(prescriptionList))
                return "Receta creada con exito";
            else
                return "Error al crear la receta";
        }
    }
}
